/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package by.vdl.websort.server.dao.rowmapper;

import by.vdl.websort.server.entity.StudyDTO;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author zeor
 */
public class StudyRowMapper implements RowMapper<StudyDTO>{

    public StudyDTO mapRow(ResultSet rs, int i) throws SQLException {
        StudyDTO studyDTO = new StudyDTO();
        studyDTO.setId(rs.getLong("id"));
        studyDTO.setName(rs.getString("name"));
        studyDTO.setUserId(rs.getLong("user_id"));
        studyDTO.setCreatedDate(rs.getTimestamp("created_date"));

        return studyDTO;
    }
    
}
